package com.bw.zg3park2212.point

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.*
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class PointViewModel @Inject constructor(val apiService: ApiService): BaseViewModel() {
    val pointSuccse=MutableLiveData<PointEntity>()
    fun getpoint(){
        httpRequst(
            {apiService.getpoint()},
            pointSuccse::postValue
        )
    }
    val pointsearchSuccse=MutableLiveData<PointEntity>()
    fun getpointsearch(location:String,name:String){
        httpRequst(
            {apiService.getpointsearch(location, name)},
            pointsearchSuccse::postValue)
    }
    val pointxiangSuccse=MutableLiveData<PointEntityItem>()
    fun getpointxiang(id:Int){
        httpRequst(
            {apiService.getpointxiang(id)},
            pointxiangSuccse::postValue)
    }
    val pointaddSuccse=MutableLiveData<PointEntityItem>()
    fun getpointadd(pointAddParam: PointAddParam){
        httpRequst(
            {apiService.getpointadd(pointAddParam)},
            pointaddSuccse::postValue)
    }
    val pointdeleteSuccse=MutableLiveData<Boolean>()
    fun getpointdelete(id:Int){
        httpRequst(
            {apiService.getpointdel(id)},
            pointdeleteSuccse::postValue)
    }
    val taskSuccse=MutableLiveData<TaskEntity>()
    fun gettask(){
        httpRequst(
            {apiService.gettask()},
            taskSuccse::postValue
        )
    }
    var orderSucsse=MutableLiveData<OrderEntity>()
    fun getorder(){
        httpRequst(
            {apiService.getorder()},
            orderSucsse::postValue)
    }
}